package cn.iocoder.yudao.module.train.controller.wechat.coursegroup;

import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.train.controller.admin.coursegroup.vo.CourseGroupPageReqVO;
import cn.iocoder.yudao.module.train.controller.admin.coursegroup.vo.CourseGroupRespVO;
import cn.iocoder.yudao.module.train.controller.admin.coursegroup.vo.CourseGroupSaveReqVO;
import cn.iocoder.yudao.module.train.dal.dataobject.coursegroup.CourseGroupDO;
import cn.iocoder.yudao.module.train.service.coursegroup.CourseGroupService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.GET;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "小程序接口 - 课程组管理")
@RestController
@RequestMapping("/wechat-api/course-group")
@Validated
public class WechatCourseGroupController {

    @Resource
    private CourseGroupService courseGroupService;

    @PostMapping("/list")
    @Operation(summary = "获得课程组管理")
    @ApiAccessLog(operateType = GET)
    public CommonResult<List<CourseGroupRespVO>> getCourseGroupPage() {
        List<CourseGroupDO> pageResult = courseGroupService.getCourseGroupList();
        return success(BeanUtils.toBean(pageResult, CourseGroupRespVO.class));
    }

}
